import { axiosMock, delayFn, randArrItem } from '@/services/axiosMock'
import { IInpTransferOrderNumRes } from '../interface'

axiosMock('default', mock => {
  // 录入转单号
  mock.onPost(`/tmsapi/waybill_record/saveWaybillNumber`).reply(
    delayFn<IInpTransferOrderNumRes>(600, ({ data }) => {
      const waybillTrackingResults = Array(data.waybillTrackingList.length)
        .fill(null)
        .map(() => {
          const success = randArrItem([true, true, false])
          return {
            success,
            message: success ? null : '识别错误',
          }
        })
      return {
        success: true,
        data: { waybillTrackingResults },
      }
    }),
  )
})
